#ifndef AST_FUNCTION_DEFINITION_H
#define AST_FUNCTION_DEFINITION_H
#include "../ASTNode.h"

#include <iostream>

class DeclarationSpecifiers;
class Declarator;
class DeclarationList;
class CompoundStmt;

/*
(C99 6.9.1)
function-definition:
		declaration-specifiers	declarator	declaration-list(opt)	compound-statement
*/
class FunctionDefinition : public ASTNode
{
protected:
	FunctionDefinition()
		:ASTNode(ASTNode::function_definition), m_pDSpecifiers(NULL), m_pDList(NULL), m_pDeclarator(NULL), m_pStmts(NULL){};
public:
	FunctionDefinition(DeclarationSpecifiers *pDSpecifiers, Declarator *pDeclarator, CompoundStmt *pStmts) 
		: ASTNode(ASTNode::function_definition)
		, m_pDSpecifiers(pDSpecifiers)
		, m_pDeclarator(pDeclarator)
		, m_pDList(NULL)
		, m_pStmts(pStmts){};
	FunctionDefinition(DeclarationSpecifiers *pDSpecifiers, Declarator *pDeclarator, DeclarationList *  pDList, CompoundStmt *pStmts)
		: ASTNode(ASTNode::function_definition)
		, m_pDSpecifiers(pDSpecifiers)
		, m_pDeclarator(pDeclarator)
		, m_pDList(pDList)
		, m_pStmts(pStmts){};

	virtual ~FunctionDefinition();
	
	virtual void					codeGen();

protected:
	DeclarationSpecifiers *				m_pDSpecifiers;
	Declarator *						m_pDeclarator;
	DeclarationList	*					m_pDList;
	CompoundStmt *						m_pStmts;
};
#endif


